// 云函数入口文件
const cloud = require('wx-server-sdk')
cloud.init({
    env: "cloudwx-dm78q"
})
DB = cloud.database().collection("supply");

cloud.init()

// 云函数入口函数
//新增供货记录
exports.main = async (event, context) => {


    return DB.add({
        // newData 字段表示需新增的 JSON 数据
        data: {
            createDate: event.newData.createDate,
            marketId: event.newData.marketId,
            marketName: event.newData.marketName,
            opererId: event.newData.opererId,
            products: event.newData.products,
            status: event.newData.status,
            supplyDate: event.newData.supplyDate,
            supplypics: event.newData.supplypics,
            total: event.newData.total
        }
    })
        .then(res => {
            console.log(res);
        })
        .catch(console.error)


}